<template>
    <div class="div">
        <div class="main">
             <h4 v-text="newsinfo.title"></h4>
            <hr/>
            <div v-html="newsinfo.content" class="section"></div>
        </div>
      <!-- plong -->
        <comment :newid="id"></comment>
    </div>
    
</template>
<script>

import comment from './comment.vue';
export default {
    data(){
        return{
          id:this.$route.params.id,
          newsinfo:[],
        }
    },
    methods:{
        get(){
            this.$http.get("api/getnew/"+this.id).then(
                result=>{
                    if(result.body.status==0){
                         this.newsinfo=result.body.message[0]
                    }else{
                        console.log("失败");
                    }
                }
            )
        }
    },
    created:function(){
        this.get();
    },
    components:{
       "comment":comment,
    }
   
}
</script>
<style lang="scss" scoped>
.div{
     margin: 20px 10px 70px 10px;
      
    .main{
        h4{
            text-align: center;
            font-size: 16px;
            margin-bottom: 10px;
        }
        p{
            margin: 10px 0px;
            text-align: justify; 
        }
    background:#ffffff;
    padding: 20px 10px;
    margin-bottom: 20px;
    }
    
}

</style>